﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data;

public partial class DefaultAJAX : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
    {
        if (this.RadioButton2.Checked)
        {
            Database db = DatabaseFactory.CreateDatabase("MRPSqlServer");
            string sSQL =("SELECT ID, CompanyName, CustomerCode FROM MRP_Customer;");
            DataSet ds = db.ExecuteDataSet(CommandType.Text, sSQL);

            DropDownList1.DataSource = ds.Tables[0].DefaultView;
            DropDownList1.DataTextField = "CustomerCode";
            DropDownList1.DataValueField = "ID";

            DropDownList1.DataBind();


        }
        else
        {
            DropDownList1.Items.Clear();
            DropDownList1.DataSource = null;

        }
    }
}
